<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Father{
            constructor(uname,gender){
                this.uname=uname;
                this.gender='男';
                // 父类实例方法
                this.say=function(){
                    console.log('Father say');
                }
            }
            //父类原型方法
            drink(){
                console.log('Father drink');
            }
        }

        class Son extends Father{
            constructor(uname,age){
                //super关键字调用父类实例属性
                super(uname);//必须在子构造器的this调用之前
                // super.say();
                this.age=age;
                this.talk=function(){
                    console.log('');
                }
            }
            eat(){
                console.log('吃饭');
                //super关键字调用父类原型方法 : super.父类原型方法() 
                //子类里super关键字不能调用父类实例方法,只能调用原型方法
                super.drink();
            }
        }
        var s=new Son('张三',20);
        console.log(s);
        s.eat();
        s.say();
    </script>
</body>
</html>